<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title>测试模块</title>

        <script type="text/javascript">

            const require = function ( fn ){
                const m = { exports: {} }
                fn( m.exports , arguments.callee , m );
                return m.exports ;
            }

            let first = function ( exports , require , module ){
                console.log( exports === module.exports );
                const random = {
                    nextInt(bound){
                        let float = Math.random() * bound ;
                        let integer = float | 0 ;
                        return integer ;
                    },
                    nextBoolean(){
                        return Math.random() > 0.5 ;
                    }
                }
                module.exports = random ;
            }

            let second = function ( exports , require , module ){
                let random = require( first );
                console.log( random.nextInt(100) );
                console.log( random.nextBoolean() );
                module.exports = random.nextInt(1000);
            }

            let x = require( second );
            console.log( x );

        </script>

    </head>
    <body>
        
    </body>
</html>